<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%--<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>--%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@include file="/common/taglibs.jspf"%>

<!DOCTYPE html>
<html lang="en">

<head>
    <title><spring:message code="sys.site.title" arguments="${platformName}"/></title>
    <meta name="keywords" content="<spring:message code="sys.site.keywords" arguments="${platformName}"/>">
    <meta name="description" content="<spring:message code="sys.site.description" arguments="${platformName}"/>">
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="Thu, 19 Nov 1900 08:52:00 GMT">
    <link rel="stylesheet" href="${staticPath}/plugins/layui/css/layui.css">
    <script src="${staticPath}/plugins/layui/layui.js?v=2.2.6"></script>
    <script src="${staticPath}/plugins/jquery/jquery-2.1.4.min.js?v=2.1.4"></script>
    <script src="${staticPath}/plugins/jquery/jquery.cookie-1.3.1.js?v=1.3.1"></script>
    <style type="text/css">
        html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, em, p, font, img, small, strong, center, dl, dt, dd, ol, ul, li, form, label, table, caption, tbody, tr, th, td {margin:0;padding:0;border:0;outline:0;}
        html,body{position: relative;width: 100%;box-sizing:border-box;position: relative;background: #fff;font-size: 16px;min-width: 1000px;}
        ol, ul {list-style:none} :focus {outline:none; }
        table {border-collapse:collapse;border-spacing: 0}
        caption, th, td { text-align: left; font-weight: normal}
        strong {font-weight:600}
        a{font:16px Arial;color:#404040;cursor:pointer;}
        h1{font-size:16px;font-weight:600;color:#666} .left{float:left} .right{float:right} .clear{clear:both}
        .clearfix:after {content:"\200B";display:block;height:0;clear:both; }
        .clearfix {*zoom:1;}/*IE/7/6*/
        table {border-collapse:collapse;border-spacing:0;table-layout:fixed;}
        .header{height: 110px;border-bottom: 3px solid #e5e5e5;background: #f3fbfe;width: 100%;box-sizing: border-box;display: inline-block;margin: 0 0}
        .header dl dt{display: inline-block;float: left;width: 280px;background: url(${appPath}/statics/images/tslogo.png) no-repeat 30px center;font-size: 0;height: 110px;}
        .header dl dd{float: left;background: url(${appPath}/statics/images/border.jpg) no-repeat left center;height: 110px;}
        .header dl dd p{font-family:YouYuan; font-size: 22px;color: #656464;display: inline-block;margin:36px 0 36px 30px ;}
        .header dl dd p span{font-size: 12px;display: block;}
        .box{min-height: 600px;}
        .box .left{width: 520px;height: 400px;margin: 100px 0 0 0;}
        .box .right{width: 356px;margin: 100px 0 0 10%; float: left;border: 2px solid #90CAFC;height: 377px;}
        .box .right h3{height: 73px;background: #3fa1fa;color: #fff;position: relative;font-family:"幼圆" YouYuan;line-height: 73px;text-indent: 30px;font-size: 20px;font-weight: normal; }
        .box .right h3 img{position: absolute;top: -10px;right:40px ;}
        /*.box .right #username{width: 290px;height: 40px;border: 1px solid #3FA1FA;text-indent: 40px;margin:34px 0 0 30px;}*/
        /*.box .right #password{width: 290px;height: 40px;border: 1px solid #3FA1FA;text-indent: 40px;margin:20px 0 0 30px;}*/
        /*.box .right input[type="submit"]{width: 290px;color: #fff;font-size: 20px;background: #3FA1FA;border: 1px solid #90CAFC;height: 42px;margin-left: 30px;cursor: pointer}*/
        .box .right .remember{margin: 16px 0 16px 30px;vertical-align: middle;}
        .box .right span{color: #8e8e8e;font-size: 14px;}
        .box .right p{text-align: center;margin-top: 20px;}
        .box .right p a{padding: 0 30px;font-family: "微软雅黑";font-size: 12px;color: #3FA1FA;}
        .box .right p a:first-child{border-right: 2px solid #b0b0b0;}
        .footer{clear: both;width: 100%;height: 50px;border-top: 3px solid #e5e5e5;line-height: 50px;text-align: center;clear: both;background: #f3fbfe;color: #3d6e7d;position: fixed;left: 0;bottom: 0;font-size: 12px;padding-top: 0px}
        input:-webkit-autofill,
        input:-webkit-autofill:hover,
        input:-webkit-autofill:focus,
        input:-webkit-autofill:active {
            -webkit-transition-delay: 9999s;
            -webkit-transition: color 9999s ease-out, background-color 9999s ease-out;
        }
        .layui-btn-fluid{
            width: 290px;
            color: #fff;
            font-size: 20px;
            margin-left: 30px;
            cursor: pointer;
            height: 42px;
        }
        .box .center{
            text-align: center;
            color: red;
            padding: 5px;
        }
        .layadmin-user-login-body .layui-form-item {
            position: relative;
        }
        .layadmin-user-login-body .layui-form-item .layui-input {
            padding-left: 38px;
        }
        .layadmin-user-login-icon {
            position: absolute;
            left: 1px;
            top: 1px;
            width: 38px;
            line-height: 36px;
            text-align: center;
            color: #d2d2d2;
            z-index: 9;
        }
        .layui-form-select dl dd.layui-this {
            background-color: #1E9FFF;
            color: #fff;
        }
        .layui-input:focus, .layui-textarea:focus {
            border-color: #66afe9 !important;
            box-shadow: 0 0 5px 0 #93cdf9;
        }
    </style>
</head>

<body id="signin-page">
    <div class="header">
        <dl>
            <dt>
                cc
            </dt>
            <dd>
                <p><spring:message code="sys.site.title" arguments="${platformName}"/><span><spring:message code="sys.site.title.en" /></span></p>
            </dd>
        </dl>
    </div>
    <div class="page-form"  style="width:1024px;margin: 0 auto">
        <form  id="loginform"  method="post" class="layui-form" onsubmit="saveUsername(this);">
            <div class="body-content box">
                <div class="left">
                    <img src="${appPath}/statics/images/box.png" />
                </div>
                <div class="right layadmin-user-login-box layadmin-user-login-body layui-form">
                    <h3>登录账号<img src="${appPath}/statics/images/head.png"/></h3>
                    <div style="margin: 15px 15px">
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-website" for="orgId"></label>
                            <select id="orgId" name="orgId" lay-filter="aihao">
                                <c:forEach items="${organizationList}" var="org">
                                    <option value="${org.code}">${org.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="username"></label>
                        <input type="text" name="username" id="username" lay-verify="required" placeholder="用户名" class="layui-input">
                    </div>
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="password"></label>
                            <input type="password" name="password" id="password" lay-verify="required" placeholder="密码" class="layui-input">
                        </div>
                    </div>
                    <div class="form-group" style="margin-top:40px;">
                        <%--<div class="pull-left">--%>
                            <%--<div class="checkbox-list">--%>
                                <%--<input id="rememberMe"  type="checkbox" name="rememberMe" value="1" class="i-checks">&nbsp; <spring:message code="sys.login.rememberMe"/>--%>
                                <%--<span class="lbl"><fmt:message key="login.rememberMe"/></span>--%>
                            <%--</div>--%>
                        <%--</div>--%>
                            <div class="layui-form-item">
                                <button type="submit"  class="layui-btn layui-btn-normal layui-btn-fluid" lay-submit="" lay-filter="LAY-user-login-submit"><spring:message code="sys.login.submit.label"/></button>
                            </div>
                        <div class="center">
                            <c:if test="${error != null}">
                                <div class="alert alert-danger alert-dismissable red">
                                    <%--<spring:message code="message.login.error"/>--%>
                                   ${error }
                                </div>
                            </c:if>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </form>
    </div>

</body>

<script type="text/javascript">

    var _topWin = window;
    while (_topWin != _topWin.parent.window) {
        _topWin = _topWin.parent.window;
    }
    if (window != _topWin)_topWin.document.location.href = '${appPath}/login';

    layui.use(['layer', 'form'], function(){
            var layer = layui.layer
                ,form = layui.form;
            window.initOrg = function(){
                //设置机构
                var username = $("#username").val()||'';
                $('#orgId').find('option').removeAttr("disabled");
                $.post('${appPath}/system/user/getUserInfo/'+username,function (data) {
                    $('#orgId').find('option').each(function () {
                       if(data.extend.organizations.indexOf(String(this.value)) < 0){
                            $(this).attr("disabled",true);
                        }
                    })
                    form.render('select');
                })
            }
        });
        if ($.cookie("username") != null && $.cookie("username") != "") {
            $("#username").val($.cookie("username"));
            $("#password").focus();
        } else {
            $("#username").focus();
        }

        function saveUsername(theForm) {
            $.cookie("username",theForm.username.value, { expires: 30, path: "<c:url value="/"/>"});
        }
        $(function(){
            var serachtimer;
            $("#username").bind("input propertychange",function(){
                clearTimeout(serachtimer);
                serachtimer=setTimeout(function(){
                    initOrg();
                },1000)
            });
        })
</script>
</html>